<template>
	<view>
		<view class="login_title">
			<view class="img">
				<image src="../../static/img/ceshi.jpg" mode="widthFix"></image>
			</view>
		</view>
		<!-- 表单 -->
		<view class="form_add">
			<uni-forms :modelValue="formData">
				<uni-forms-item >
					<uni-easyinput prefixIcon="search" v-model="formData.account_num" placeholder="请输入用户名" @iconClick="onClickUserName"></uni-easyinput>
				</uni-forms-item>
				<uni-forms-item style="padding-bottom: 0;">
					<uni-easyinput prefixIcon="search" type="password" v-model="formData.password" placeholder="请输入密码" @iconClick="onClickPassword"></uni-easyinput>
				</uni-forms-item>
				<view class="message">
					<view class="rem_password">
							<radio v-model="rem_password" style="transform:scale(0.6)" /><text>记住密码</text>
					</view>
					<view class="forget">
						忘记密码
					</view>
				</view>
			</uni-forms>
			<button type="primary" @click="login">登录</button>
			<button type="primary" @click="handleRegis" style="background-color: #C0C0C0;">注册</button>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad(){
			var my=this.encryptDes();
			this.APP_scode=my.APP_scode;
		},
		data() {
			return {
				formData:{
					account_num:'',
					password:''
				},
				rem_password:'',
				APP_scode:''
			};
		},
		methods:{
			handleRegis(){
				uni.navigateTo({
					url:'../register/register'
				})
			},
			async login(){
				// uni.request({
				// 	url:'https://wemall.minephone.com/openTask/qq_operTask/backend/public/index.php/api/Ajaxapi/login',
				// 	method:'POST',
				// 	data:this.formData,
				// 	header:{
				// 		"Content-Type": "application/json",
				// 		"App-Key":'87fce399d54e92a1d93b09d49a9da273',
				// 		"App-Scode":this.APP_scode
				// 	},
				// 	success:(res=>{
				// 		console.log(res)
				// 	})
				// })
				var res=await this.$request({url:'/login',data:this.formData,methods:'POST',header:this.APP_scode})
				console.log(res)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.login_title{
		.img{
			width: 220rpx;
			height: 220rpx;
			border-radius: 50%;
			margin: 100rpx auto;
			image{
				width: 100%;
				border-radius: 50%;
			}
		}
	}
	.form_add{
		padding: 0 10%;
		.message{
			display: flex;
			font-size: 30rpx;
			position: relative;
			top: -40rpx;
			justify-content: space-between;
			align-items: center;
			.rem_password{
				display: flex;
				align-items: center;
			}
		}
		button{
			height: 80rpx;
			background-color: #4CD964;
			font-size: 34rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			margin-bottom: 30rpx;
			border-radius: 0;
		}
	}
</style>
